<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        
    </style>
</head>
<body>
    <div class="box" abc="这是abc" title="这是title">
        <span>1</span>
        <!-- 这是注释 -->
        <span>2</span>
        这是文本
        <span>3</span>
    </div>
</body>
<script>

    var oBox = document.querySelector(".box")

    var child = oBox.childNodes;

    var txt = child[6];
    var comment = child[3];
    var span = child[1];
    var attr = oBox.attributes[1];
    var doc = document;

    console.log(txt);
    console.log(comment);
    console.log(span);
    console.log(attr);
    console.log(doc);
    
    // 节点类型：nodeType
    console.log(txt.nodeType);
    console.log(comment.nodeType);
    console.log(span.nodeType);
    console.log(attr.nodeType);
    console.log(doc.nodeType);
    
    // 节点名：nodeName
    console.log(txt.nodeName);
    console.log(comment.nodeName);
    console.log(span.nodeName);
    console.log(attr.nodeName);
    console.log(doc.nodeName);
    
    // 节点值：nodeValue
    console.log(txt.nodeValue);
    console.log(comment.nodeValue);
    console.log(span.nodeValue);
    console.log(attr.nodeValue);
    console.log(doc.nodeValue);


    // 节点的过滤
    for(var i=0;i<child.length;i++){
        if(child[i].nodeType === 3){
            console.log(child[i]);
        }
    }

    
</script>
</html>